<?php require_once '../library/Question.php'; ?>
<?php require_once '../library/Score.php'; ?>
<?php
$Question = new Question();
$Question->checkUser();
$errors = '';
$msg = '';
if (isset($_POST['submit'])) {

    $errors = array();

    foreach ($_POST as $key => $value) {
        if (empty($_POST[$key]) || !isset($_POST[$key])) {
            array_push($errors, ucfirst(str_replace('_', ' ', $key)));
        }
    }

    if (empty ($error)) {
        $resultRange = range(6, 24);
        $aggregate = intval($_POST['aggregate']);
        if (in_array($aggregate, $resultRange)) {
            header("Location: wizard.php");
            exit;
        } else {
            array_push($errors, "You don't qualify to take this test");
        }

    }

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Test</title>
    <link rel="stylesheet" href="../css/StyleSheet/styles.css" type="text/css"/>

    <link rel="stylesheet" href="../js/datepicker/jquery-ui-1.8.14.custom.css"/>
    <script type="text/javascript" src="../js/datepicker/jquery-1.5.1.min.js"></script>
    <script type="text/javascript" src="../js/datepicker/jquery-ui-1.8.14.custom.min.js"></script>
    <script type="text/javascript" src="../js/datepicker/datepicker.js"></script>
    <style type="text/css">
        input[type=submit] {
            font-size: 130%;
            height: 30px;
            width: 20%;
            margin-left: 550px;
            text-shadow: 0 1px 1px #FFFFFF;
            color: #1C4257;
            background-color: #A5CEE5;
            border-radius: 8px;
        }

        div#content {
            padding: 20px 10px 0 10px;
            background-color: #FFF;

        }
        .msg {
            font-weight: bold;
            color:  #f00;
        }
    </style>
</head>

<body>
<div id="container">
    <div id="header">
        <h1><span>FIND YOUR MAJOR</span></h1>

        <div id="slogan-text" class="header-slogan">your major partner</div>

    </div>
    <div id="nav">
        <ul>
            <Li><a href="index.php">Home</a></li>
            <Li><a href="about.php">About Us</a></li>
            <li><a href="">Majors</a></li>
            <Li><a href="">Schools</a></li>
            <Li><a href="contact.php">Contact Us</a></li>
            <Li><a href="#" id="quiz" class="quiz">Take Quiz</a></li>

        </ul>

    </div>
    <div id="content">
        <div id="page">
            <div class="msg">
                <?php if (!empty($errors)) {
                $msg = "You have error(s) in the following fields: ";
                foreach ($errors as $error) {
                    $msg .= $error . ', ';
                }
                echo rtrim($msg, ', ');;
            } ?>
            </div>

            <fieldset id="field">
                <legend id="legend">Quiz Begins</legend>
                <p style="margin-left:90px; font-size:14px"> After taking this Quiz you will be recommended the top
                    university major <br/>
                    <b> Fill the form Below with the correct data for appropriate results</b>.
                </p>

            </fieldset>

            <form action="" method="post">
                <table width="80%" align="center" cellspacing="15">

                    <tr>
                        <td><p>1.What is your High School Graduating year?</p></td>
                        <td><select name="year" id="year" class="year" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="1999">1999</option>
                            <option value="2000">2000</option>
                            <option value="2001">2001</option>
                            <option value="2002">2002</option>
                            <option value="2003">2003</option>
                            <option value="2004">2004</option>
                            <option value="2005">2005</option>
                            <option value="2006">2006</option>
                            <option value="2007">2007</option>
                            <option value="2008">2008</option>
                            <option value="2009">2009</option>
                            <option value="2010">2010</option>
                            <option value="2011">2011</option>
                            <option value="2012">2012</option>
                        </select>
                        </td>
                    </tr>
                    <tr>
                        <td><p>2.What type of exam have you taken?</p></td>
                        <td><select name="exam" id="exam" class="exam" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="WASSCE">WASSCE</option>
                            <option value="SSSCE">SSSCE</option>
                        </select>
                        </td>
                    </tr>
                    <tr>
                        <td><p>3.What are your grades in the following core subjects?</p></td>
                    </tr>
                    <tr align="center">
                        <td><p>a. English Language</p></td>
                        <td><select name="english_result" id="result" class="result" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="A">A</option>
                            <option value="A1">A1</option>
                            <option value="B">B</option>
                            <option value="B2">B2</option>
                            <option value="B3">B3</option>
                            <option value="C">C</option>
                            <option value="C4">C4</option>
                            <option value="C5">C5</option>
                            <option value="C6">C6</option>
                            <option value="D">D</option>
                            <option value="D7">D7</option>
                            <option value="E">E</option>
                            <option value="E8">E8</option>
                            <option value="F">F</option>
                            <option value="F9">F9</option>
                        </select></td>
                    </tr>
                    <tr align="center">
                        <td><p>b. Core Mathematics</p></td>
                        <td><select name="math_result" id="result" class="result" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="A">A</option>
                            <option value="A1">A1</option>
                            <option value="B">B</option>
                            <option value="B2">B2</option>
                            <option value="B3">B3</option>
                            <option value="C">C</option>
                            <option value="C4">C4</option>
                            <option value="C5">C5</option>
                            <option value="C6">C6</option>
                            <option value="D">D</option>
                            <option value="D7">D7</option>
                            <option value="E">E</option>
                            <option value="E8">E8</option>
                            <option value="F">F</option>
                            <option value="F9">F9</option>
                        </select></td>
                    </tr>
                    <tr align="center">
                        <td><p>c. Integrated Science</p></td>
                        <td><select name="science_result" id="result" class="result" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="A">A</option>
                            <option value="A1">A1</option>
                            <option value="B">B</option>
                            <option value="B2">B2</option>
                            <option value="B3">B3</option>
                            <option value="C">C</option>
                            <option value="C4">C4</option>
                            <option value="C5">C5</option>
                            <option value="C6">C6</option>
                            <option value="D">D</option>
                            <option value="D7">D7</option>
                            <option value="E">E</option>
                            <option value="E8">E8</option>
                            <option value="F">F</option>
                            <option value="F9">F9</option>
                        </select></td>
                    </tr>
                    <tr align="center">
                        <td><p>d. Social Studies</p></td>
                        <td><select name="social_studies_result" id="result" class="result" style="width: 100px">
                            <option value="">Choose</option>
                            <option value="A">A</option>
                            <option value="A1">A1</option>
                            <option value="B">B</option>
                            <option value="B2">B2</option>
                            <option value="B3">B3</option>
                            <option value="C">C</option>
                            <option value="C4">C4</option>
                            <option value="C5">C5</option>
                            <option value="C6">C6</option>
                            <option value="D">D</option>
                            <option value="D7">D7</option>
                            <option value="E">E</option>
                            <option value="E8">E8</option>
                            <option value="F">F</option>
                            <option value="F9">F9</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td><p>4.What is your overall agregate of best six result?</p></td>
                        <td><input type="text" id="aggregate" name="aggregate" style="width: 100px"/>
                        </td>
                    </tr>

                </table>
                <tr>
                    <td><input type="submit" name="submit" id="submit" value="Continue"/></td>
                </tr>

            </form>

        </div>
        <div class="clear"></div>
    </div>

    <div id="footer">
        <p>&copy; 2012 ernydey,All rights reserved.</p>
    </div>

</div>
</body>
</html>
